<template>
  <div id="app">
    <h1>Todo List</h1>
    <form @submit.prevent="addTodo">
      <input type="text" v-model="newTodo" placeholder="Add new todo">
      <button type="submit">Add</button>
    </form>
    <ul>
      <li v-for="(todo, index) in todos" :key="index">
        <span>{{ todo }}</span>
        <button @click="editTodo(index)">Edit</button>
        <button @click="deleteTodo(index)">Delete</button>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      todos: ['Learn Vue', 'Build a todo app', 'Learn CSS'],
      newTodo: ''
    }
  },
  methods: {
    addTodo() {
      if (this.newTodo.trim() !== '') {
        this.todos.push(this.newTodo.trim())
        this.newTodo = ''
      }
    },
    editTodo(index) {
      const newTodo = prompt('Edit todo', this.todos[index])
      if (newTodo !== null && newTodo.trim() !== '') {
        this.todos.splice(index, 1, newTodo.trim())
      }
    },
    deleteTodo(index) {
      if (confirm('Are you sure you want to delete this todo?')) {
        this.todos.splice(index, 1)
      }
    }
  }
}
</script>

<style>
/* Add your CSS styles here */
h1 {
  color: blue;
  font-size: 2.5rem;
  text-align: center;
}

form {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

input[type="text"] {
  padding: 0.5rem;
  font-size: 1.2rem;
  border: none;
  border-radius: 0.25rem;
  margin-right: 0.5rem;
  flex-grow: 1;
}

button[type="submit"] {
  padding: 0.5rem 1rem;
  font-size: 1.2rem;
  border: none;
  border-radius: 0.25rem;
  background-color: blue;
  color: white;
  cursor: pointer;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  background-color: #f4f4f4;
  border-radius: 0.25rem;
}

li span {
  flex-grow: 1;
  margin-right: 0.5rem;
}

li button {
  padding: 0.5rem 1rem;
  font-size: 1.2rem;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
}

li button:first-child {
  background-color: blue;
  color: white;
  margin-right: 0.5rem;
}

li button:last-child {
  background-color: red;
  color: white;
}
</style>